#include "KMP_pattern_match.h"

int length = 1024;
char str[1024];
char ptn[1024];

int main(){
    //scanf("%s",str);
    //scanf("%s",ptn);
    fgets(str,1024,stdin);
    str[strcspn(str, "\n")] = '\0';
    fgets(ptn,1024,stdin);
    str[strcspn(ptn, "\n")] = '\0';
    int diff = KMP_match(str,ptn,0);
    printf("%d\n",diff);
    return 0;
}
